{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\vgonz\Dropbox\Pitt\OneDrive for Business\Dissertation - Vale\Paper 2 - Political-Economic Polarization\Replication\Log\3_5_CMP_PRITM_Appendix_ER.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}29 Aug 2024, 15:43:25

{com}. do "C:\Users\vgonz\Dropbox\Pitt\OneDrive for Business\Dissertation - Vale\Paper 2 - Political-Economic Polarization\Replication\Do\3_5_CMP_PRITM_Appendix_ER.do"
{txt}
{com}. *****************************************************************************
. * Cleaning and Analyzing - PRITM countries. Alternative proxy                           *
. *   . Polarization proxy as Esteban and Ray 1994        *
. *                                               Manifesto Project Database                          *
. *                                                                                                                                           *
. * Author:                       Valentina Gonzalez-Rostani                                                      *
. * Contact:                      mag384@pitt.edu                                                                 *
. * Date:                         March 21 2021                                                                           *
. * Version:                      Stata 17                                                                        *
. *                                                                                                                                                       *
. *****************************************************************************
. 
. /*
> This do-file:
>         A. Call the Data
>         B. Define variables
>         C. Export Tables 
> 
> Input: ** Manifesto Project database**
>         - Data\CMP\MPDataset_MPDS2020a_stata14.dta // Data download from https://manifesto-project.wzb.eu/datasets 2021
> 
> 
> Final output:
>         Cleaned data: 
>                 * "Data\CMP_ER.dta" this data contains the relevant variables for the analysis with the DV as the polarization over redistribution, and fixed-value positions, estimated following Esteban and Ray 1994.
>         Tables:
>                 * table A23: Partisan Polarization over Redistribution and Fixed Attributes
> 
> 
> */
. cd "C:\Users\vgonz\Dropbox\Pitt\OneDrive for Business\Dissertation - Vale\Paper 2 - Political-Economic Polarization\Replication" // Only change your directory
{res}C:\Users\vgonz\Dropbox\Pitt\OneDrive for Business\Dissertation - Vale\Paper 2 - Political-Economic Polarization\Replication
{txt}
{com}. 
. * Processing of the data (alternatively skip and go to line 314)
. {c -(}
. *##########################################
. * A. Calling the data
. *##########################################
. {c -(}
. 
. use "Data\CMP\MPDataset_MPDS2020a_stata14.dta", replace
{txt}(Manifesto Project Dataset Version 2020a. Please type "notes" for more details)
{com}. 
. {c )-}
. *############################################
. * B. Creating Variables
. *############################################
. {c -(}
. * YEAR
. gen year = year(edate) 
. 
. * Keep countries of interest
. keep if countryname=="Australia" |  countryname=="Canada" |  countryname=="Greece" |  countryname=="New Zealand" |  countryname=="Portugal" |  countryname=="Spain" |  countryname=="United Kingdom" |  countryname=="United States" |  countryname=="France" |  countryname=="Norway" | countryname=="Austria" | countryname=="Belgium" | countryname=="Denmark" | countryname=="Estonia" | countryname=="Finland" | countryname=="Hungary" | countryname=="Germany" | countryname=="Iceland"  | countryname=="Ireland"  | countryname=="Italy"  | countryname=="Netherlands"  | countryname=="Norway" | countryname=="Slovakia" | countryname=="Slovenia" | countryname=="Sweden" | countryname=="Switzerland"
{txt}(1,682 observations deleted)
{com}. 
. * Defines a dummy to identify PRITM countries
. gen PRITM=. 
{txt}(2,900 missing values generated)
{com}. replace PRITM=0 if countryname=="Australia"
{txt}(111 real changes made)
{com}. replace PRITM=0 if countryname=="Canada"
{txt}(94 real changes made)
{com}. replace PRITM=0 if countryname=="Greece"
{txt}(84 real changes made)
{com}. replace PRITM=0 if countryname=="New Zealand"
{txt}(101 real changes made)
{com}. replace PRITM=0 if countryname=="Portugal"
{txt}(101 real changes made)
{com}. replace PRITM=0 if countryname=="Spain"
{txt}(157 real changes made)
{com}. replace PRITM=0 if countryname=="United Kingdom"
{txt}(98 real changes made)
{com}. replace PRITM=0 if countryname=="United States"
{txt}(53 real changes made)
{com}. replace PRITM=0 if countryname=="France"
{txt}(116 real changes made)
{com}. 
. replace PRITM=1 if countryname=="Austria"
{txt}(83 real changes made)
{com}. replace PRITM=1 if countryname=="Belgium"
{txt}(184 real changes made)
{com}. replace PRITM=1 if countryname=="Denmark"
{txt}(235 real changes made)
{com}. replace PRITM=1 if countryname=="Estonia"
{txt}(47 real changes made)
{com}. replace PRITM=1 if countryname=="Finland"
{txt}(162 real changes made)
{com}. replace PRITM=1 if countryname=="Germany"
{txt}(89 real changes made)
{com}. replace PRITM=1 if countryname=="Hungary"
{txt}(43 real changes made)
{com}. replace PRITM=1 if countryname=="Iceland"
{txt}(117 real changes made)
{com}. replace PRITM=1 if countryname=="Ireland"
{txt}(103 real changes made)
{com}. replace PRITM=1 if countryname=="Italy"
{txt}(178 real changes made)
{com}. replace PRITM=1 if countryname=="Netherlands"
{txt}(178 real changes made)
{com}. replace PRITM=1 if countryname=="Norway"
{txt}(130 real changes made)
{com}. replace PRITM=1 if countryname=="Slovenia"
{txt}(72 real changes made)
{com}. replace PRITM=1 if countryname=="Slovakia"
{txt}(69 real changes made)
{com}. replace PRITM=1 if countryname=="Sweden"
{txt}(137 real changes made)
{com}. replace PRITM=1 if countryname=="Switzerland"
{txt}(158 real changes made)
{com}. 
. 
. * CONTROL VARIABLES - number of parties
. 
. gen number = 1
. egen number2= sum(number), by(edate)
. lab var number2 "Number of parties"
. 
. *############################################################
. * DEPENDENT VARIABLE Redistribution and Fixed Attributes
. *############################################################
. * Obtaining relevant policy variables
. {c -(}
. gen welfare_policy =  ln(per504+0.5) - ln(per505+0.5)
{txt}(7 missing values generated)
{com}. 
. gen fixed = .
{txt}(2,900 missing values generated)
{com}. replace fixed = (ln(per107+per108+per407+per602+0.5+per602_2)-ln(per109+per110+per406+per601+0.5+per601_2)) if !missing(per602_2) & !missing(per601_2)
{txt}(333 real changes made)
{com}. replace fixed = (ln(per107+per108+per407+per602+0.5)-ln(per109+per110+per406+per601+0.5)) if missing(per602_2) | missing(per601_2)
{txt}(2,560 real changes made)
{com}. 
. {c )-}
. ** Different code compared to 3_2 do file: 
. {c -(}
. **  Mainstream left: - soc social democratic and socialist or other left
. gen m_left = . 
{txt}(2,900 missing values generated)
{com}. replace m_left = 1 if parfam== 30 | parfam== 20
{txt}(904 real changes made)
{com}. replace m_left = 0 if parfam ~= 30 & parfam ~=20 & parfam ~=. 
{txt}(1,996 real changes made)
{com}. 
. egen m_left_participation= max(m_left), by(edate)
. 
. 
. **  Mainstream left: only soc social democratic
. gen m_left_restrict = . 
{txt}(2,900 missing values generated)
{com}. replace m_left_restrict = 1 if parfam== 30
{txt}(577 real changes made)
{com}. replace m_left_restrict = 0 if parfam ~= 30 & parfam ~=. 
{txt}(2,323 real changes made)
{com}. 
. ** Other left: Ecologista and socialist
. gen o_left = . 
{txt}(2,900 missing values generated)
{com}. replace o_left = 1 if  parfam== 10  // here I am also including socialist or other left
{txt}(147 real changes made)
{com}. replace o_left = 0 if parfam ~= 10  & parfam ~=. 
{txt}(2,753 real changes made)
{com}. 
. egen o_left_participation= max(o_left), by(edate)
. 
. ** Mainstream right: lib liberal, Christian Democrat, Conservatives
. gen m_right = . 
{txt}(2,900 missing values generated)
{com}. replace m_right = 1 if parfam == 40 | parfam == 50 | parfam == 60
{txt}(1,174 real changes made)
{com}. replace m_right = 0 if parfam ~= 40 & parfam ~= 50 & parfam ~= 60 & parfam ~=. 
{txt}(1,726 real changes made)
{com}. 
. egen m_right_participation= max(m_right), by(edate)
. 
. ** Other right: agriculture
. gen o_right = . 
{txt}(2,900 missing values generated)
{com}. replace o_right = 1 if parfam == 80
{txt}(133 real changes made)
{com}. replace o_right = 0 if parfam ~= 80 & parfam ~=. 
{txt}(2,767 real changes made)
{com}. 
. egen o_right_participation= max(o_right), by(edate)
. 
. ** Radical right:  nat nationalist 
. gen rad_right = . 
{txt}(2,900 missing values generated)
{com}. replace rad_right = 1 if parfam == 70 
{txt}(221 real changes made)
{com}. replace rad_right = 0 if parfam ~= 70 & parfam ~=. 
{txt}(2,679 real changes made)
{com}. 
. egen rad_right_participation= max(rad_right), by(edate)
. 
. 
. ** Other parties: special issues and Ethnic and regional parties
. gen o_parties = . 
{txt}(2,900 missing values generated)
{com}. replace o_parties = 1 if parfam == 90 | parfam == 95 
{txt}(321 real changes made)
{com}. replace o_parties = 0 if parfam ~= 90 & parfam ~= 95  & parfam ~=. 
{txt}(2,579 real changes made)
{com}. 
. egen o_parties_participation= max(o_parties), by(edate)
. 
. 
. ** DISTANCE
. {c -(}
. foreach x of varlist welfare_policy  fixed  {c -(}
{txt}  2{com}. 
. gen `x'_m_left = m_left*`x' if m_left==1
{txt}  3{com}. gen `x'_rad_right = rad_right*`x' if rad_right==1
{txt}  4{com}. gen `x'_m_right = m_right*`x' if m_right==1
{txt}  5{com}. 
. gen `x'_o_left = o_left*`x' if o_left==1
{txt}  6{com}. gen `x'_o_right = o_right*`x' if o_right==1
{txt}  7{com}. gen `x'_o_parties = o_parties*`x' if o_parties==1
{txt}  8{com}. 
. replace `x'_m_left = 0 if `x'_m_left ==.
{txt}  9{com}. replace `x'_rad_right = 0 if `x'_rad_right ==.
{txt} 10{com}. replace `x'_m_right = 0 if `x'_m_right ==.
{txt} 11{com}. replace `x'_o_left = 0 if `x'_o_left ==.
{txt} 12{com}. replace `x'_o_right = 0 if `x'_o_right ==.
{txt} 13{com}. replace `x'_o_parties = 0 if `x'_o_parties ==.
{txt} 14{com}.         
. {c )-}
{txt}(1,998 missing values generated)
(2,682 missing values generated)
(1,727 missing values generated)
(2,753 missing values generated)
(2,767 missing values generated)
(2,580 missing values generated)
(1,998 real changes made)
(2,682 real changes made)
(1,727 real changes made)
(2,753 real changes made)
(2,767 real changes made)
(2,580 real changes made)
(1,998 missing values generated)
(2,682 missing values generated)
(1,727 missing values generated)
(2,753 missing values generated)
(2,767 missing values generated)
(2,580 missing values generated)
(1,998 real changes made)
(2,682 real changes made)
(1,727 real changes made)
(2,753 real changes made)
(2,767 real changes made)
(2,580 real changes made)
{com}. 
. foreach x of varlist m_left rad_right m_right o_left o_right o_parties {c -(}
{txt}  2{com}. 
. egen vote_`x' = mean(pervote), by(countryname edate `x')
{txt}  3{com}. replace vote_`x'=. if `x'==0
{txt}  4{com}. {c )-}
{txt}(4 missing values generated)
(1,996 real changes made, 1,996 to missing)
(2,679 real changes made, 2,679 to missing)
(1,726 real changes made, 1,726 to missing)
(1 missing value generated)
(2,753 real changes made, 2,753 to missing)
(1 missing value generated)
(2,767 real changes made, 2,767 to missing)
(2,579 real changes made, 2,579 to missing)
{com}. 
. 
. 
. sort countryname edate
. {c )-}
. * Collapsing the data 
. {c -(}
. collapse (sum) fixed* welf*  (first) *_participation year  PRITM  totseats number2 oecdmember date (mean) vote_* , by(edate countryname)
{res}{com}. {c )-}
. // Final Prep of the data
. {c -(}
. egen country_number = group(countryname)
. 
. sort country_number edate
. bysort country_number: gen election_order=_n
. xtset country_number election_order
{res}
{col 1}{txt:Panel variable: }{res:country_number}{txt: (unbalanced)}
{p 1 16 2}{txt:Time variable: }{res:election_order}{txt:, }{res:{bind:1}}{txt: to }{res:{bind:28}}{p_end}
{txt}{col 10}Delta: {res}1 unit
{com}. 
. 
. gen alpha=1.6
. 
. 
. 
. 
. foreach x of varlist  welfare_policy fixed {c -(}
{txt}  2{com}. 
. * Distance
. // Mainstream left - other left
. gen `x'_ml_ol =  vote_m_left^(alpha)*vote_o_left^(alpha)*abs(`x'_m_left -`x'_o_left)
{txt}  3{com}. replace `x'_ml_ol =  0 if o_left_participation==0
{txt}  4{com}. 
. // Mainstream left - mainstream right
. gen `x'_ml_mr =  vote_m_left^(alpha)*vote_m_right^(alpha)*abs(`x'_m_left -`x'_m_right)
{txt}  5{com}. replace `x'_ml_mr =  0 if m_right_participation==0
{txt}  6{com}. 
. // Mainstream left - radical right
. gen `x'_ml_rr =  vote_m_left^(alpha)*vote_rad_right^(alpha)*abs(`x'_m_left -`x'_rad_right)
{txt}  7{com}. replace `x'_ml_rr =  0 if rad_right_participation==0
{txt}  8{com}. 
. // Mainstream left - other right
. gen `x'_ml_or =  vote_m_left^(alpha)*vote_o_right^(alpha)*abs(`x'_m_left -`x'_o_right)
{txt}  9{com}. replace `x'_ml_or =  0 if o_right_participation==0
{txt} 10{com}. 
. // Mainstream left - other parties
. gen `x'_ml_op =  vote_m_left^(alpha)*vote_o_parties^(alpha)*abs(`x'_m_left -`x'_o_parties)
{txt} 11{com}. replace `x'_ml_op =  0 if o_parties_participation==0
{txt} 12{com}. 
. //////
> // Mainstream right - other left
. gen `x'_mr_ol =  vote_m_right^(alpha)*vote_o_left^(alpha)*abs(`x'_m_right -`x'_o_left)
{txt} 13{com}. replace `x'_mr_ol =  0 if o_left_participation==0
{txt} 14{com}. 
. // Mainstream right - radical right
. gen `x'_mr_rr =  vote_m_right^(alpha)*vote_rad_right^(alpha)*abs(`x'_m_right -`x'_rad_right)
{txt} 15{com}. replace `x'_mr_rr =  0 if rad_right_participation==0
{txt} 16{com}. 
. // Mainstream right - other right
. gen `x'_mr_or =  vote_m_right^(alpha)*vote_o_right^(alpha)*abs(`x'_m_right -`x'_o_right)
{txt} 17{com}. replace `x'_mr_or =  0 if o_right_participation==0
{txt} 18{com}. 
. // Mainstream right - other party
. gen `x'_mr_op =  vote_m_right^(alpha)*vote_o_parties^(alpha)*abs(`x'_m_right -`x'_o_parties)
{txt} 19{com}. replace `x'_mr_op =  0 if `x'_mr_op==.
{txt} 20{com}. 
. 
. ///// Radical right
> // Radical right - other left
. gen `x'_rr_ol =  vote_rad_right^(alpha)*vote_o_left^(alpha)*abs(`x'_rad_right -`x'_o_left)
{txt} 21{com}. replace `x'_rr_ol =  0 if o_left_participation==0
{txt} 22{com}. 
. // Radical right - other right
. gen `x'_rr_or =  vote_rad_right^(alpha)*vote_o_right^(alpha)*abs(`x'_rad_right -`x'_o_right)
{txt} 23{com}. replace `x'_rr_or =  0 if o_right_participation==0
{txt} 24{com}. 
. // Radical right - other party
. gen `x'_rr_op =  vote_rad_right^(alpha)*vote_o_parties^(alpha)*abs(`x'_rad_right -`x'_o_parties)
{txt} 25{com}. replace `x'_rr_op =  0 if o_parties_participation==0
{txt} 26{com}. 
. ///// Other left
> // Other left - other right
. gen `x'_ol_or =  vote_o_left^(alpha)*vote_o_parties^(alpha)*abs(`x'_o_left -`x'_o_right)
{txt} 27{com}. replace `x'_ol_or =  0 if o_right_participation==0
{txt} 28{com}. 
. // Other left - other party
. gen `x'_ol_op =  vote_o_left^(alpha)*vote_o_parties^(alpha)*abs(`x'_o_left -`x'_o_parties)
{txt} 29{com}. replace `x'_ol_op =  0 if o_parties_participation==0
{txt} 30{com}. 
. //// Other right
> // Other right- other party
. gen `x'_or_op =  vote_o_right^(alpha)*vote_o_parties^(alpha)*abs(`x'_o_right -`x'_o_parties)
{txt} 31{com}. replace `x'_or_op =  0 if o_parties_participation==0
{txt} 32{com}. 
. gen distance_`x' = `x'_ml_ol+ `x'_ml_mr+ `x'_ml_rr+ `x'_ml_or+ `x'_ml_op+ `x'_mr_ol+ `x'_mr_rr+ `x'_mr_or +`x'_mr_op+ `x'_rr_ol+ `x'_rr_or+ `x'_rr_op+ `x'_ol_or+ `x'_ol_op+ `x'_or_op
{txt} 33{com}. 
. gen distance_`x'2 = `x'_ml_mr+ `x'_ml_rr+ `x'_ml_or+ `x'_mr_rr+ `x'_mr_or  + `x'_rr_or
{txt} 34{com}. gen distance_`x'3 = `x'_ml_mr+ `x'_ml_rr+ `x'_mr_rr  
{txt} 35{com}. 
. 
. 
. 
. 
. {c )-}
{txt}(344 missing values generated)
(342 real changes made)
(1 missing value generated)
(0 real changes made)
(292 missing values generated)
(287 real changes made)
(345 missing values generated)
(338 real changes made)
(294 missing values generated)
(289 real changes made)
(344 missing values generated)
(342 real changes made)
(291 missing values generated)
(287 real changes made)
(345 missing values generated)
(338 real changes made)
(293 missing values generated)
(293 real changes made)
(394 missing values generated)
(342 real changes made)
(435 missing values generated)
(338 real changes made)
(396 missing values generated)
(289 real changes made)
(410 missing values generated)
(337 real changes made)
(410 missing values generated)
(289 real changes made)
(440 missing values generated)
(289 real changes made)
(289 missing values generated)
(100 missing values generated)
(5 missing values generated)
(344 missing values generated)
(342 real changes made)
(1 missing value generated)
(0 real changes made)
(292 missing values generated)
(287 real changes made)
(345 missing values generated)
(338 real changes made)
(294 missing values generated)
(289 real changes made)
(344 missing values generated)
(342 real changes made)
(291 missing values generated)
(287 real changes made)
(345 missing values generated)
(338 real changes made)
(293 missing values generated)
(293 real changes made)
(394 missing values generated)
(342 real changes made)
(435 missing values generated)
(338 real changes made)
(396 missing values generated)
(289 real changes made)
(410 missing values generated)
(337 real changes made)
(410 missing values generated)
(289 real changes made)
(440 missing values generated)
(289 real changes made)
(289 missing values generated)
(100 missing values generated)
(5 missing values generated)
{com}. 
. gen shock=.
{txt}(474 missing values generated)
{com}. replace shock =0 if year > 1969 & year < 1995
{txt}(166 real changes made)
{com}. replace shock =1 if  year > 1994        
{txt}(167 real changes made)
{com}. {c )-}
. {c )-}
. {c )-}
. *############################################
. * Saving the data
. *############################################
. {c -(}
. 
. lab var PRITM "PR with Trichotomous Multipartism"
. lab var totseats "Total Number of Seats"
. lab var number2 "Total Number of Parties"
. lab var oecdmember "OECD member"
. lab var PRITM "PRITM"
. 
. lab var distance_welfare_policy3 "Distance Redistribution (DR) - Net Welfare"
. lab var distance_fixed3 "Distance Fixed-Value Positions (DFVP) - Net Anti-Global"
. 
. lab var shock "High LMP period" // post 1994
. 
. keep  PRITM year  countryname  oecdmember totseats shock distance_welfare_policy3 distance_fixed3   number2 election_order country_number
. 
. keep if year>1969
{txt}(141 observations deleted)
{com}. keep if PRITM==1
{txt}(131 observations deleted)
{com}. 
. save "Data\CMP_ER.dta", replace
{txt}{p 0 4 2}
file {bf}
Data\CMP_ER.dta{rm}
saved
{p_end}
{com}. 
. {c )-}
. {c )-}
{txt}
{com}. * Alternatively load prepared data
. {c -(}
. use "Data\CMP_ER.dta", clear    
{txt}(Manifesto Project Dataset Version 2020a. Please type "notes" for more details)
{com}. {c )-}
{txt}
{com}. *##########################################
. * Analysis
. *##########################################
. {c -(}
. 
. // table A23: Partisan Polarization over Redistribution and Fixed Attributes
. {c -(}
. preserve
. 
. eststo clear
. eststo: qui reg distance_welfare_policy3 L.distance_welfare_policy3 shock totseats  oecdmember  number2 , cluster(countryname)
{txt}({res}est1{txt} stored)
{com}. eststo: qui reg distance_fixed3 L.distance_fixed3 shock totseats  oecdmember  number2 , cluster(countryname)
{txt}({res}est2{txt} stored)
{com}. 
. 
. 
. esttab , replace label se title(Partisan Polarization over Redistribution and Fixed Attributes  \label {c -(}TabWithinER{c )-}) mti("Redistribution" "Fixed Values" "Redistribution" "Fixed Values") compress nogap star(* 0.1 ** 0.05 *** 0.01) b(%6.3f) keep(shock    ) scalars( "N Observations" "r2 R$^2$" "aic AIC" ) indicate("Control variables = tot*" "LDV = L.*" )
{res}
{txt}Partisan Polarization over Redistribution and Fixed Attributes \label {TabWithinER}
{txt}{hline 42}
{txt}                       (1)          (2)   
{txt}                 Redistr~n    Fixed V~s   
{txt}{hline 42}
{txt}High LMP period {res}  -3.3e+03      1.1e+04***{txt}
                {res} {ralign 9:{txt:(}1.3e+04{txt:)}}    {ralign 9:{txt:(}3248.358{txt:)}}   {txt}
{txt}Control variab~s{res}       Yes          Yes   {txt}
{txt}LDV             {res}       Yes          Yes   {txt}
{txt}{hline 42}
{txt}Observations    {res}       180          180   {txt}
{txt}R$^2$           {res}     0.326        0.295   {txt}
{txt}AIC             {res}  4589.552     4358.513   {txt}
{txt}{hline 42}
{txt}Standard errors in parentheses
{txt}* p<0.1, ** p<0.05, *** p<0.01
{com}. 
. esttab using "Table\TabWithin_ER.tex", replace label se title(Partisan Polarization over Redistribution and Fixed Attributes  \label {c -(}TabWithinER{c )-}) mti("Redistribution" "Fixed Values" "Redistribution" "Fixed Values") compress nogap star(* 0.1 ** 0.05 *** 0.01) b(%6.3f) keep(shock    ) scalars( "N Observations" "r2 R$^2$" "aic AIC" ) indicate("Control variables = tot*" "LDV = L.*" )
{res}{txt}(output written to {browse  `"Table\TabWithin_ER.tex"'})
{com}. 
. restore
. {c )-}
. {c )-}
{txt}
{com}. 
{txt}end of do-file

{com}. exit, clear
